#include <stdio.h>
#include <string.h>

int m;

void move(char from, char to) {
    ++m;
}

void hanoi(int n, char a, char b, char c) {
    if (n == 1) {
        move(a, c);
    }
    else {
        hanoi(n-1, a, c, b);
        move(a, c);
        hanoi(n-1, b, a, c);
    }
}

int main() {
    int n;
    scanf("%d", &n);
    m = 0;
    hanoi(n, 'a', 'b', 'c');
    printf("%d", m);
}